package com.roc.util.constant;

import java.util.HashMap;

import org.apache.commons.lang3.StringUtils;

/**
 * 
 * @author zbl
 * 商户状态
 *
 */
public enum MerinfoReturninfo {
	
	S_0("00","获取操作员失败"), 
	S_1("01","生成商户号失败"), 
	S_2("02","后台获取终端信息失败"), 
	S_3("03","后台获取产品信息失败"), 
	S_4("04","后台获取手续费信息失败"), 
	S_5("05","上传的资料照片信息不全"), 
	S_6("06","提交商户信息成功"), //成功提示
	S_7("07","获取营业时间失败"), 
	S_8("08","完善商户信息成功"), //完善提示
	S_9("09","冻结商户成功"), //冻结提示
	
	S_10("10","获取商户信息失败，请重试"),
	S_11("11","商户状态非法"),
	S_12("12","注销商户成功"), //注销提示
	S_13("13","解冻商户成功"),
	S_14("14","操作频繁，请6分钟后重试"),
	S_15("15","商户状态已更新，请勿重复操作"),
	S_16("16","该商户已被注销"),
	S_17("17","获取32域失败"),
	S_18("18","获取审核意见失败"),
	S_19("19","更新领件状态失败"),
	S_20("20","驳回商户信息成功"),
	S_21("21","审核失败，更新原有状态失败"),
	S_22("22","审核商户信息成功"),
	S_23("23","T0借记卡手续费不能小于0.55"),
	S_24("24","T0贷记卡手续费不能小于0.55"),
	S_25("25","T1借记卡手续费不能小于0.45"),
	S_26("26","T1贷记卡手续费不能小于0.55"),
	S_27("27","装机地区非法，请重新选择"),
	S_28("28","请检查所选MCC"),
	S_29("29","获取商户失败"),
	S_30("30","该商户已被审核过了"),
	S_31("31","无此权限"),
	S_32("32","获取营业执照失败"),
	S_33("33","获取法人身份证失败"),
	S_34("34","获取结算卡号失败"),
	S_35("35","已经开启批量审核"),
	S_36("36","非法人结算必须填写非法人身份证号"),
	S_37("37","法人结算账户名称必须是法人名称"),
	S_38("38","获取商户注册地址省份失败"),
	S_39("39","获取商户注册地址城市失败"),
	S_40("40","获取商户注册地址区县失败"),
	S_41("41","请检查输入的手机号码格式"),
	S_42("42","商户简称已存在，请核实"),
	S_43("43","商户简称只能输入汉字、字母、数字且 8~20位"),
	S_44("44","支付宝微信手续费不能小于0.3"),
	S_45("45","暂存商户信息成功"),
	S_46("46","未正确填写结算信息"),
	S_47("47","未正确填写营业执照有效期开始时间"),
	S_48("48","未正确填写身份证有效期截止时间"),
	S_49("49","未正确填写身份证有效期开始时间"),
	S_50("50","未正确填写营业执照有效期截止时间"),
	S_51("51","所属机构不能为空"),
	S_52("52","T1借记卡手续费封顶范围18~999"),
	S_53("53","直营商户审核成功"),
	S_54("54","直营商户审核失败"),
	S_55("55","直营商户驳回成功"),
	S_56("56","直营商户驳回失败"),
	S_57("57","云商宝自动进件失败"),
	S_58("58","查询云商宝费率信息失败"),
	S_59("59","更新云商宝费率临时表状态失败"),
	S_60("60","提交费率变更成功"),
	S_61("61","提交费率变更失败，云商宝会员T1借记卡手续费超出范围(0.5~0.75正常)"),
	S_62("62","提交费率变更失败，云商宝会员T1借记卡手续费封顶值超出范围(20~300正常)"),
	S_63("63","提交费率变更失败，云商宝会员T1贷记卡手续费超出范围(0.55~0.75正常)"),
	S_64("64","提交费率变更失败，云商宝会员T0借记卡手续费超出范围(0.55~0.75正常)"),
	S_65("65","提交费率变更失败，云商宝会员T0贷记卡手续费超出范围(0.55~0.75正常)"),
	S_66("66","T0借记卡手续费封顶范围20~999"),
	S_67("67","T0借记卡代付服务费费率范围0.03~0.99");;

	private String code;
	private String name;
	
	private MerinfoReturninfo(String code,String name){
		this.code=code;
		this.name=name;
	}
	
	public static MerinfoReturninfo valueOfCode(String code) {
		if (StringUtils.isBlank(code)) {
			throw new IllegalArgumentException("Merchant Status " + code + " is blank");
		}
		for (MerinfoReturninfo mt : values()) {
			if (mt.getCode().equals(code)) {
				return mt;
			}
		}
		throw new IllegalArgumentException("Merchant Type " + code + " is not exist");
	}
	
	/**
	 * 通过ID获取中文名称
	 * @param code
	 * @return
	 */
	public static String getName(String code) {
		if (StringUtils.isBlank(code)) {
			throw new IllegalArgumentException("MerberFlag code " + code
					+ " is blank");
		}
		for (MerinfoReturninfo mt : values()) {
			if (mt.getCode().equals(code)) {
				return mt.getName();
			}
		}
		throw new IllegalArgumentException("MerberFlag code  " + code
				+ " is not exist");
	}
	
	/**
	 * 获取所有的枚举,以MAP返回
	 * @return
	 */
	public static HashMap<String,String> getAllEnumMap() {
		
		HashMap<String,String> map = new HashMap<String,String>();
		
		for (MerinfoReturninfo mt : values()) {
			map.put(mt.getCode(), mt.getName());
		}
		
		return map;
		
	}
	
	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}
	
	
	
}
